package com.fucheng.tcp;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

    public static void main(String[] args) throws IOException {

        ServerSocket serverSocket = new ServerSocket(6666);

        System.out.println("server started......");

        // 如果ServerSocket监听成功，我们就使用一个无限循环来处理客户端的连接
        for(;;){
            Socket socket = serverSocket.accept();
            System.out.println("client connected......" + socket.getRemoteSocketAddress());

            Thread t = new Handler(socket) ;
            t.start();
        }
    }
}

